//
//  LoginViewController.m
//  qiuShiJiangHu
//
//  Created by xalo on 16/1/25.
//  Copyright © 2016年 糗事江湖项目组. All rights reserved.
//

#import "LoginViewController.h"
#import "RegistViewController.h"
@interface LoginViewController ()<UITextFieldDelegate>


@property (strong, nonatomic) IBOutlet UITextField *userNameTF;


@property (strong, nonatomic) IBOutlet UITextField *passWordTF;

@property (strong, nonatomic) IBOutlet UIButton *loginWithSinaBlog;

@property (strong, nonatomic) IBOutlet UIButton *loginWithRenRen;

@property (strong, nonatomic) IBOutlet UIButton *regist;

@property (strong, nonatomic) IBOutlet UIButton *login;

@property (strong, nonatomic) IBOutlet UIImageView *sinaPicture;

@property (strong, nonatomic) IBOutlet UIImageView *renRenPicture;




@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self keyboardReturn];
    [self setLoginViewBasicInfo];
    
    
    
    // Do any additional setup after loading the view.
}

- (void)setLoginViewBasicInfo {
    
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"loginBack.jpg"]];
    self.loginWithSinaBlog.backgroundColor = [UIColor whiteColor];
    self.sinaPicture.image = [UIImage imageNamed:@"sinaBlog.png"];
    self.loginWithRenRen.backgroundColor = [UIColor whiteColor];
    self.renRenPicture.image = [UIImage imageNamed:@"renren.jpg"];
    
    [self.login.layer setMasksToBounds:YES];
    [self.login.layer setCornerRadius:10.0];
    self.login.backgroundColor = [UIColor orangeColor];
    
    [self.regist.layer setMasksToBounds:YES];
    [self.regist.layer setCornerRadius:10.0];
    self.regist.backgroundColor = [UIColor orangeColor];
}



- (IBAction)login:(UIButton *)sender {
    
    if ([self.userNameTF.text isEqualToString:@""] || [self.passWordTF.text isEqualToString:@""]) {
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"用户名或密码不能为空" preferredStyle:(UIAlertControllerStyleAlert)];
        UIAlertAction *okButton = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:nil];
        [alert addAction:okButton];
        alert.view.tintColor = [UIColor redColor];
        [self presentViewController:alert animated:YES completion:nil];
    }else{
        
        
        NSLog(@"登录");
        
        
    }

    
}



- (IBAction)registButton:(UIButton *)sender {
    
    RegistViewController *registView = [[UIStoryboard storyboardWithName:@"yan" bundle:nil]instantiateViewControllerWithIdentifier:@"RegistViewController"];
    [self.navigationController pushViewController:registView animated:YES ];
    
    
    
}






- (void)keyboardReturn {
    
    self.userNameTF.delegate = self;
    self.passWordTF.delegate = self;

}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    
    [textField resignFirstResponder];
    return YES;
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
